package iqq.util;

import iqq.im.bean.QQUser.QQUserStatus;

import javax.swing.ImageIcon;

import com.alee.laf.label.WebLabel;

/**
 * @author ChenZhiHui
 * @create-time 2013-3-8
 */
public class StatusUtils {

	public final static String STATUS_ICON_PREFIX = "icons/status/status_";
	public final static String STATUS_ICON_EXTENSION = ".png";

	public static ImageIcon getStatusIcon(String name) {
		if (!Strings.isEmpty(name)) {
			System.out.println(STATUS_ICON_PREFIX + name
					+ STATUS_ICON_EXTENSION);
			return ImageManager.getImageIcon(STATUS_ICON_PREFIX + name
					+ STATUS_ICON_EXTENSION);
		}
		return null;
	}

	public static ImageIcon getStatusIcon(QQUserStatus status) {
		if (status != null) {
			return getStatusIcon(status.getName());
		}
		return null;
	}

	public static WebLabel statusToLabel(QQUserStatus status) {
		if (status != null) {
			return new WebLabel(status.getName(), ImageUtils.getScaledInstance(
					getStatusIcon(status), 12, 12));
		}
		return null;
	}

}
